import pickle

"""
pickle
dumps() serialization
loads() anti-serialization

dump() serialization in a file
load() anti-serialization from a file
"""
str_01 = "this is a serialization test"
list_01 = [1, 2, 3, 4]
res_01 = pickle.dumps(str_01)
res_02 = pickle.dumps(list_01)
res_03 = pickle.loads(res_02)
print(res_01, type(res_01))
print(res_02, type(res_02))
print(res_03, type(res_03))
with open("../Enclosure/create_02.txt", "wb") as fp:
    fp.write(res_02)
with open("../Enclosure/create_02.txt", "rb") as fp:
    res_04 = fp.read()
res_05 = pickle.loads(res_04)
print(res_05)
with open("../Enclosure/create_03.txt", "wb") as fp:
    pickle.dump(list_01,fp)
with open("../Enclosure/create_03.txt", "rb") as fp:
    res_06=pickle.load(fp)
print(res_06)